<!DOCTYPE HTML>
<html>
<head>
    <title>查看短租房</title>
    <% include common/meta.ejs %>
    <% include common/public.ejs %>
    <%
//    let cityMap = {
//        '001': '杭州',
//        '002': '绍兴',
//        '003': '无锡'
//    };
    let cityMap = {};
    var tempArray1 = data.cityList;
    for(let idx of tempArray1.keys()){
        cityMap[tempArray1[idx].code] = tempArray1[idx].name;
    }
//    let houseTypeMap = {
//        '04': '一室一厅',
//        '02': '次卧',
//        '05': '二室一厅',
//        '01': '单间',
//        '03': '主卧'
//    };

    let houseTypeMap = {};
    var tempArray2 = data.houseType;
    for(let idx of tempArray2.keys()){
        houseTypeMap[tempArray2[idx].code] = tempArray2[idx].name;
    }
    %>
</head>
<body ontouchstart="">
<div class="weui_tab">
    <div class="weui_navbar">
        <a href="javascript:void(0)" class="weui_navbar_item conditionLocation">
            <%= data.condition.location==''?'选择位置':cityMap[data.condition.location] %>
            <img class="downIcon" src="<%= global.config.publicPath %>/page/images/icon/butler/down24.png"/>
        </a>
        <a href="javascript:void(0)" class="weui_navbar_item conditionHouseType">
            <%= data.condition.houseType==''?'选择房型':houseTypeMap[data.condition.houseType] %>
            <img class="downIcon" src="<%= global.config.publicPath %>/page/images/icon/butler/down24.png"/>
        </a>
    </div>
    <div class="weui_tab_bd">

        <div class="weui_panel weui_panel_access">
            <div class="weui_panel_bd">
                <% for(var i = 0;i < data.houseList.length;i++) { %>
                <a href="shortRentDetail?groupFlag=1&apartmentCity=<%= data.houseList[i].apartmentCity %>&houseType=<%= data.houseList[i].houseType %>&openId=<%= session.openId %>"
                   class="weui_media_box weui_media_text weui_media_appmsg">
                    <div class="weui_media_hd">
                        <img class="weui_media_appmsg_thumb"
                             src="<%= '/yams-upload' + (data.houseList[i].primaryImage || '/images/noImage.png') %>"
                             alt="">
                    </div>
                    <div class="weui_media_bd">
                        <span class="weui_media_title" style="font-size: 0.75rem;"><%= data.houseList[i].shortDesc %></span>
                        <p class="weui_media_desc">
                            <%= data.houseList[i].name %>
                            <span style="color: #0BB20C;">可入住</span>
                        </p>
                        <ul class="weui_media_info" style="color: #666;">
                            <li class="weui_media_info_meta"><%= houseTypeMap[data.houseList[i].houseType] %></li>
                            <li class="weui_media_info_meta"><%= data.houseList[i].area + '平米' %></li>
                        </ul>
                        <p class="weui_media_desc">
                            <strong><%=
                                (data.houseList[i].shortPrices.SRT00 ? data.houseList[i].shortPrices.SRT00+'元/天' : '') %>
                            </strong></li>
                        </p>
                        <p class="weui_media_desc">
                            <strong><%=
                                (data.houseList[i].shortPrices.SRT03 ? data.houseList[i].shortPrices.SRT03+'元/3小时' : '') %></strong></li>
                            <strong><%=
                                (data.houseList[i].shortPrices.SRT05 ? data.houseList[i].shortPrices.SRT05+'元/5小时' : '') %></strong></li>
                            <strong><%=
                                (data.houseList[i].shortPrices.SRT08 ? data.houseList[i].shortPrices.SRT08+'元/8小时' : '') %></strong></li>
                        </p>
                    </div>
                </a>
                <% } %>
            </div>
        </div>
    </div>
</div>

<% include common/footer.ejs %>
<script>
    $('.conditionLocation').click(function () {
        $.actions({
            title: '请选择位置',
            actions: (function () {
                let items = [{
                    text: '不限',
                    onClick: function () {
                        location.href = CTX + '/view/shortRentList?groupFlag=1&houseType=<%= data.condition.houseType %>&location=';
                    }
                }];
                <% for(let key in cityMap){ %>
                items.push({
                    text: '<%= cityMap[key] %>',
                    onClick: function () {
                        location.href = CTX + '/view/shortRentList?groupFlag=1&houseType=<%= data.condition.houseType %>&location=<%= key %>';
                    }
                })
                <% } %>
                return items;
            })()
        });
    });
    $('.conditionHouseType').click(function () {
        $.actions({
            title: '请选择位置',
            actions: (function () {
                let items = [{
                    text: '不限',
                    onClick: function () {
                        location.href = CTX + '/view/shortRentList?groupFlag=1&houseType=&location=<%= data.condition.location %>';
                    }
                }];
                <% for(let key in houseTypeMap){ %>
                items.push({
                    text: '<%= houseTypeMap[key] %>',
                    onClick: function () {
                        location.href = CTX + '/view/shortRentList?groupFlag=1&houseType=<%= key %>&location=<%= data.condition.location %>';
                    }
                })
                <% } %>
                return items;
            })()
        });
    });
</script>
</body>
</html>